﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using System.Windows.Controls;
using JMT.Data;
using JMT.Controls.Elements;

namespace JMT.Controls.Commands
{
    public class DeleteUIClassCommand : ICommand
    {
        private ContextMenu _contextMenu;
        private MenuItem _menuItem;

        public DeleteUIClassCommand(ContextMenu contextMenu, MenuItem menuItem)
        {
            _contextMenu = contextMenu;
            _menuItem = menuItem;
        }

        public bool CanExecute(object parameter)
        {
            return true;
        }

        public event EventHandler CanExecuteChanged;

        public void Execute(object parameter)
        {
            IJBox jBox = _contextMenu.Tag as IJBox;
            IJModel jElement = _contextMenu.DataContext as IJModel;
            jBox.Diagram.DeleteElement(jElement);
        }
    }
}
